bitkeeper revision 1.1236.1.208 (425166catD-gBcyHy-Pai8EDOXkJpw)
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 4 Apr 2005 16:09:46 +0000 (16:09 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 4 Apr 2005 16:09:46 +0000 (16:09 +0000)
Writable pagetable info is per-domain rather than per-cpu. Based on
a patch from Steven Smith.
Signed-off-by: Keir Fraser <keir@xensource.com>
12 files changed:
xen/arch/ia64/domain.c
xen/arch/ia64/xenmisc.c
xen/arch/x86/domain.c
xen/arch/x86/mm.c
xen/arch/x86/traps.c
xen/common/domain.c
xen/common/page_alloc.c
xen/common/schedule.c
xen/include/asm-ia64/domain.h
xen/include/asm-x86/domain.h
xen/include/asm-x86/mm.h
xen/include/xen/domain.h

index 96f93740833c63c2b739d1a5ba87172f9ad82531..a8f40b569edfc712037b0dec82898d09d521d946 100644 (file)
@@ -221,7 +221,7 @@ int arch_final_setup_guest(struct exec_domain *p, full_execution_context_t *c)
        return 1;
 }
 
-void domain_relinquish_memory(struct domain *d)
+void domain_relinquish_resources(struct domain *d)
 {
        dummy();
 }
index 1d3a951a64800b91cc0b38d0002765274677ce41..8553335f91365d449df634c757a6c4d804615c69 100644 (file)
@@ -68,8 +68,6 @@ void grant_table_destroy(struct domain *d)
 
 struct pt_regs *get_execution_context(void) { return ia64_task_regs(current); }
 
-void cleanup_writable_pagetable(struct domain *d, int what) { return; }
-
 void raise_actimer_softirq(void)
 {
        raise_softirq(AC_TIMER_SOFTIRQ);
index efcc269f9b7f3b17d16e458b3cf749a3aa7aaea4..a62f9ab1315a44769b2d720d9912b23afeef58e1 100644 (file)
@@ -275,6 +275,8 @@ void arch_do_createdomain(struct exec_domain *ed)
             mk_l3_pgentry(__pa(d->arch.mm_perdomain_l2) | __PAGE_HYPERVISOR);
 #endif
 
+        (void)ptwr_init(d);
+
         shadow_lock_init(d);        
     }
 }
@@ -940,7 +942,24 @@ unsigned long __hypercall_create_continuation(
     return op;
 }
 
-static void relinquish_list(struct domain *d, struct list_head *list)
+#ifdef CONFIG_VMX
+static void vmx_relinquish_resources(struct exec_domain *ed)
+{
+    if ( !VMX_DOMAIN(ed) )
+        return;
+
+    BUG_ON(ed->arch.arch_vmx.vmcs == NULL);
+    free_vmcs(ed->arch.arch_vmx.vmcs);
+    ed->arch.arch_vmx.vmcs = 0;
+    
+    free_monitor_pagetable(ed);
+    rem_ac_timer(&ed->arch.arch_vmx.vmx_platform.vmx_pit.pit_timer);
+}
+#else
+#define vmx_relinquish_resources(_ed) ((void)0)
+#endif
+
+static void relinquish_memory(struct domain *d, struct list_head *list)
 {
     struct list_head *ent;
     struct pfn_info  *page;
@@ -998,30 +1017,16 @@ static void relinquish_list(struct domain *d, struct list_head *list)
     spin_unlock_recursive(&d->page_alloc_lock);
 }
 
-#ifdef CONFIG_VMX
-static void vmx_domain_relinquish_memory(struct exec_domain *ed)
-{
-    struct vmx_virpit_t *vpit = &(ed->arch.arch_vmx.vmx_platform.vmx_pit);
-    /*
-     * Free VMCS
-     */
-    ASSERT(ed->arch.arch_vmx.vmcs);
-    free_vmcs(ed->arch.arch_vmx.vmcs);
-    ed->arch.arch_vmx.vmcs = 0;
-    
-    free_monitor_pagetable(ed);
-    rem_ac_timer(&(vpit->pit_timer));
-}
-#endif
-
-void domain_relinquish_memory(struct domain *d)
+void domain_relinquish_resources(struct domain *d)
 {
     struct exec_domain *ed;
 
     BUG_ON(d->cpuset != 0);
 
+    ptwr_destroy(d);
+
     /* Release device mappings of other domains */
-    gnttab_release_dev_mappings( d->grant_table );
+    gnttab_release_dev_mappings(d->grant_table);
 
     /* Exit shadow mode before deconstructing final guest page table. */
     shadow_mode_disable(d);
@@ -1042,13 +1047,9 @@ void domain_relinquish_memory(struct domain *d)
                 pagetable_val(ed->arch.guest_table_user) >> PAGE_SHIFT]);
             ed->arch.guest_table_user = mk_pagetable(0);
         }
-    }
 
-#ifdef CONFIG_VMX
-    if ( VMX_DOMAIN(d->exec_domain[0]) )
-        for_each_exec_domain ( d, ed )
-            vmx_domain_relinquish_memory(ed);
-#endif
+        vmx_relinquish_resources(ed);
+    }
 
     /*
      * Relinquish GDT mappings. No need for explicit unmapping of the LDT as 
@@ -1058,8 +1059,8 @@ void domain_relinquish_memory(struct domain *d)
         destroy_gdt(ed);
 
     /* Relinquish every page of memory. */
-    relinquish_list(d, &d->xenpage_list);
-    relinquish_list(d, &d->page_list);
+    relinquish_memory(d, &d->xenpage_list);
+    relinquish_memory(d, &d->page_list);
 }
 
 
index aca041e0c6e62a01f7c802d41116d9b8f3ca3997..9ccd93a8af70e6dcc5f74e6d3ade0f3c6e3589ff 100644 (file)
@@ -2288,8 +2288,6 @@ long do_update_descriptor(unsigned long pa, u64 desc)
  * Writable Pagetables
  */
 
-ptwr_info_t ptwr_info[NR_CPUS];
-
 #ifdef VERBOSE
 int ptwr_debug = 0x0;
 #define PTWR_PRINTK(_f, _a...) \
@@ -2300,17 +2298,15 @@ int ptwr_debug = 0x0;
 #endif
 
 /* Flush the given writable p.t. page and write-protect it again. */
-void ptwr_flush(const int which)
+void ptwr_flush(struct domain *d, const int which)
 {
     unsigned long  sstat, spte, pte, *ptep, l1va;
     l1_pgentry_t  *sl1e = NULL, *pl1e, ol1e, nl1e;
     l2_pgentry_t  *pl2e;
-    int            i, cpu = smp_processor_id();
-    struct exec_domain *ed = current;
-    struct domain *d = ed->domain;
+    int            i;
     unsigned int   modified = 0;
 
-    l1va = ptwr_info[cpu].ptinfo[which].l1va;
+    l1va = d->arch.ptwr[which].l1va;
     ptep = (unsigned long *)&linear_pg_table[l1_linear_offset(l1va)];
 
     /*
@@ -2364,10 +2360,10 @@ void ptwr_flush(const int which)
      * STEP 2. Validate any modified PTEs.
      */
 
-    pl1e = ptwr_info[cpu].ptinfo[which].pl1e;
+    pl1e = d->arch.ptwr[which].pl1e;
     for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
     {
-        ol1e = ptwr_info[cpu].ptinfo[which].page[i];
+        ol1e = d->arch.ptwr[which].page[i];
         nl1e = pl1e[i];
 
         if ( likely(l1_pgentry_val(ol1e) == l1_pgentry_val(nl1e)) )
@@ -2400,7 +2396,7 @@ void ptwr_flush(const int which)
              * Make the remaining p.t's consistent before crashing, so the
              * reference counts are correct.
              */
-            memcpy(&pl1e[i], &ptwr_info[cpu].ptinfo[which].page[i],
+            memcpy(&pl1e[i], &d->arch.ptwr[which].page[i],
                    (L1_PAGETABLE_ENTRIES - i) * sizeof(l1_pgentry_t));
             domain_crash();
             break;
@@ -2415,8 +2411,7 @@ void ptwr_flush(const int which)
     unmap_domain_mem(pl1e);
 
     perfc_incr_histo(wpt_updates, modified, PT_UPDATES);
-    ptwr_info[cpu].ptinfo[which].prev_exec_domain = ed;
-    ptwr_info[cpu].ptinfo[which].prev_nr_updates  = modified;
+    d->arch.ptwr[which].prev_nr_updates  = modified;
 
     /*
      * STEP 3. Reattach the L1 p.t. page into the current address space.
@@ -2424,7 +2419,7 @@ void ptwr_flush(const int which)
 
     if ( (which == PTWR_PT_ACTIVE) && likely(!shadow_mode_enabled(d)) )
     {
-        pl2e = &linear_l2_table[ptwr_info[cpu].ptinfo[which].l2_idx];
+        pl2e = &linear_l2_table[d->arch.ptwr[which].l2_idx];
         *pl2e = mk_l2_pgentry(l2_pgentry_val(*pl2e) | _PAGE_PRESENT); 
     }
 
@@ -2432,7 +2427,7 @@ void ptwr_flush(const int which)
      * STEP 4. Final tidy-up.
      */
 
-    ptwr_info[cpu].ptinfo[which].l1va = 0;
+    d->arch.ptwr[which].l1va = 0;
 
     if ( unlikely(sl1e != NULL) )
     {
@@ -2570,17 +2565,16 @@ static struct x86_mem_emulator ptwr_mem_emulator = {
 };
 
 /* Write page fault handler: check if guest is trying to modify a PTE. */
-int ptwr_do_page_fault(unsigned long addr)
+int ptwr_do_page_fault(struct domain *d, unsigned long addr)
 {
-    unsigned long       pte, pfn, l2e;
-    struct pfn_info    *page;
-    l2_pgentry_t       *pl2e;
-    int                 which, cpu = smp_processor_id();
-    u32                 l2_idx;
-    struct exec_domain *ed = current;
+    unsigned long    pte, pfn, l2e;
+    struct pfn_info *page;
+    l2_pgentry_t    *pl2e;
+    int              which;
+    u32              l2_idx;
 
     /* Can't use linear_l2_table with external tables. */
-    BUG_ON(shadow_mode_external(ed->domain));
+    BUG_ON(shadow_mode_external(d));
 
     /*
      * Attempt to read the PTE that maps the VA being accessed. By checking for
@@ -2600,7 +2594,7 @@ int ptwr_do_page_fault(unsigned long addr)
     /* We are looking only for read-only mappings of p.t. pages. */
     if ( ((pte & (_PAGE_RW | _PAGE_PRESENT)) != _PAGE_PRESENT) ||
          ((page->u.inuse.type_info & PGT_type_mask) != PGT_l1_page_table) ||
-         (page_get_owner(page) != ed->domain) )
+         (page_get_owner(page) != d) )
     {
         return 0;
     }
@@ -2611,7 +2605,7 @@ int ptwr_do_page_fault(unsigned long addr)
 #endif
 
     /* Writable pagetables are not yet SMP safe. Use emulator for now. */
-    if ( (ed->eid != 0) || (ed->ed_next_list != NULL) )
+    if ( d->exec_domain[0]->ed_next_list != NULL )
         goto emulate;
 
     /* Get the L2 index at which this L1 p.t. is always mapped. */
@@ -2639,8 +2633,8 @@ int ptwr_do_page_fault(unsigned long addr)
          * The ptwr_flush call below will restore the PRESENT bit.
          */
         if ( likely(l2e & _PAGE_PRESENT) ||
-             (ptwr_info[cpu].ptinfo[PTWR_PT_ACTIVE].l1va &&
-              (l2_idx == ptwr_info[cpu].ptinfo[PTWR_PT_ACTIVE].l2_idx)) )
+             (d->arch.ptwr[PTWR_PT_ACTIVE].l1va &&
+              (l2_idx == d->arch.ptwr[PTWR_PT_ACTIVE].l2_idx)) )
             which = PTWR_PT_ACTIVE;
     }
     
@@ -2652,36 +2646,31 @@ int ptwr_do_page_fault(unsigned long addr)
      * We only allow one ACTIVE and one INACTIVE p.t. to be updated at at 
      * time. If there is already one, we must flush it out.
      */
-    if ( ptwr_info[cpu].ptinfo[which].l1va )
-        ptwr_flush(which);
+    if ( d->arch.ptwr[which].l1va )
+        ptwr_flush(d, which);
 
     /*
      * If last batch made no updates then we are probably stuck. Emulate this 
      * update to ensure we make progress.
      */
-    if ( (ptwr_info[cpu].ptinfo[which].prev_exec_domain == ed) &&
-         (ptwr_info[cpu].ptinfo[which].prev_nr_updates  == 0) )
-    {
-        /* Force non-emul next time, or we can get stuck emulating forever. */
-        ptwr_info[cpu].ptinfo[which].prev_exec_domain = NULL;
+    if ( d->arch.ptwr[which].prev_nr_updates == 0 )
         goto emulate;
-    }
 
-    ptwr_info[cpu].ptinfo[which].l1va   = addr | 1;
-    ptwr_info[cpu].ptinfo[which].l2_idx = l2_idx;
+    d->arch.ptwr[which].l1va   = addr | 1;
+    d->arch.ptwr[which].l2_idx = l2_idx;
     
     /* For safety, disconnect the L1 p.t. page from current space. */
     if ( (which == PTWR_PT_ACTIVE) && 
-         likely(!shadow_mode_enabled(ed->domain)) )
+         likely(!shadow_mode_enabled(d)) )
     {
         *pl2e = mk_l2_pgentry(l2e & ~_PAGE_PRESENT);
         local_flush_tlb(); /* XXX Multi-CPU guests? */
     }
     
     /* Temporarily map the L1 page, and make a copy of it. */
-    ptwr_info[cpu].ptinfo[which].pl1e = map_domain_mem(pfn << PAGE_SHIFT);
-    memcpy(ptwr_info[cpu].ptinfo[which].page,
-           ptwr_info[cpu].ptinfo[which].pl1e,
+    d->arch.ptwr[which].pl1e = map_domain_mem(pfn << PAGE_SHIFT);
+    memcpy(d->arch.ptwr[which].page,
+           d->arch.ptwr[which].pl1e,
            L1_PAGETABLE_ENTRIES * sizeof(l1_pgentry_t));
     
     /* Finally, make the p.t. page writable by the guest OS. */
@@ -2694,8 +2683,8 @@ int ptwr_do_page_fault(unsigned long addr)
         MEM_LOG("ptwr: Could not update pte at %p\n", (unsigned long *)
                 &linear_pg_table[addr>>PAGE_SHIFT]);
         /* Toss the writable pagetable state and crash. */
-        unmap_domain_mem(ptwr_info[cpu].ptinfo[which].pl1e);
-        ptwr_info[cpu].ptinfo[which].l1va = 0;
+        unmap_domain_mem(d->arch.ptwr[which].pl1e);
+        d->arch.ptwr[which].l1va = 0;
         domain_crash();
         return 0;
     }
@@ -2710,22 +2699,32 @@ int ptwr_do_page_fault(unsigned long addr)
     return EXCRET_fault_fixed;
 }
 
-static __init int ptwr_init(void)
+int ptwr_init(struct domain *d)
 {
-    int i;
+    void *x = (void *)alloc_xenheap_page();
+    void *y = (void *)alloc_xenheap_page();
 
-    for ( i = 0; i < smp_num_cpus; i++ )
+    if ( (x == NULL) || (y == NULL) )
     {
-        ptwr_info[i].ptinfo[PTWR_PT_ACTIVE].page =
-            (void *)alloc_xenheap_page();
-        ptwr_info[i].ptinfo[PTWR_PT_INACTIVE].page =
-            (void *)alloc_xenheap_page();
+        if ( x != NULL )
+            free_xenheap_page((unsigned long)x);
+        if ( y != NULL )
+            free_xenheap_page((unsigned long)y);
+        return -ENOMEM;
     }
 
+    d->arch.ptwr[PTWR_PT_ACTIVE].page   = x;
+    d->arch.ptwr[PTWR_PT_INACTIVE].page = y;
+
     return 0;
 }
-__initcall(ptwr_init);
 
+void ptwr_destroy(struct domain *d)
+{
+    cleanup_writable_pagetable(d);
+    free_xenheap_page((unsigned long)d->arch.ptwr[PTWR_PT_ACTIVE].page);
+    free_xenheap_page((unsigned long)d->arch.ptwr[PTWR_PT_INACTIVE].page);
+}
 
 
 
index c9eebd4954dc3c12f1d2d689d75136f5a3e79f2c..73e073ab89b3d44427e50d2510f535e559278ac3 100644 (file)
@@ -262,8 +262,6 @@ asmlinkage int do_page_fault(struct xen_regs *regs)
     unsigned long off, addr, fixup;
     struct exec_domain *ed = current;
     struct domain *d = ed->domain;
-    extern int map_ldt_shadow_page(unsigned int);
-    int cpu = ed->processor;
     int ret;
 
     __asm__ __volatile__ ("mov %%cr2,%0" : "=r" (addr) : );
@@ -275,18 +273,18 @@ asmlinkage int do_page_fault(struct xen_regs *regs)
     if ( likely(VM_ASSIST(d, VMASST_TYPE_writable_pagetables)) )
     {
         LOCK_BIGLOCK(d);
-        if ( unlikely(ptwr_info[cpu].ptinfo[PTWR_PT_ACTIVE].l1va) &&
+        if ( unlikely(d->arch.ptwr[PTWR_PT_ACTIVE].l1va) &&
              unlikely((addr >> L2_PAGETABLE_SHIFT) ==
-                      ptwr_info[cpu].ptinfo[PTWR_PT_ACTIVE].l2_idx) )
+                      d->arch.ptwr[PTWR_PT_ACTIVE].l2_idx) )
         {
-            ptwr_flush(PTWR_PT_ACTIVE);
+            ptwr_flush(d, PTWR_PT_ACTIVE);
             UNLOCK_BIGLOCK(d);
             return EXCRET_fault_fixed;
         }
 
         if ( (addr < PAGE_OFFSET) &&
              ((regs->error_code & 3) == 3) && /* write-protection fault */
-             ptwr_do_page_fault(addr) )
+             ptwr_do_page_fault(d, addr) )
         {
             if ( unlikely(shadow_mode_enabled(d)) )
                 (void)shadow_fault(addr, regs);
@@ -307,6 +305,7 @@ asmlinkage int do_page_fault(struct xen_regs *regs)
          * Copy a mapping from the guest's LDT, if it is valid. Otherwise we
          * send the fault up to the guest OS to be handled.
          */
+        extern int map_ldt_shadow_page(unsigned int);
         LOCK_BIGLOCK(d);
         off  = addr - LDT_VIRT_START(ed);
         addr = ed->arch.ldt_base + off;
index cc3c5bf917c24b1b443e872afc326bc58fa648cf..b79c42e0ec0e0d802f8a4d2f3837030d64cd1531 100644 (file)
@@ -122,7 +122,7 @@ void domain_kill(struct domain *d)
     {
         for_each_exec_domain(d, ed)
             sched_rem_domain(ed);
-        domain_relinquish_memory(d);
+        domain_relinquish_resources(d);
         physdev_destroy_state(d);
         put_domain(d);
     }
@@ -199,7 +199,7 @@ unsigned int alloc_new_dom_mem(struct domain *d, unsigned int kbytes)
     {
         if ( unlikely((page = alloc_domheap_page(d)) == NULL) )
         {
-            domain_relinquish_memory(d);
+            domain_relinquish_resources(d);
             return list_empty(&page_scrub_list) ? -ENOMEM : -EAGAIN;
         }
 
index 0fa705dff0e50c6d0124f3379d6a29a462c43093..653124f37f6b5acd8ae6bd291255444a8b4a48f2 100644 (file)
@@ -542,7 +542,7 @@ void free_domheap_pages(struct pfn_info *pg, unsigned int order)
 
     if ( unlikely(IS_XEN_HEAP_FRAME(pg)) )
     {
-        /* NB. May recursively lock from domain_relinquish_memory(). */
+        /* NB. May recursively lock from relinquish_memory(). */
         spin_lock_recursive(&d->page_alloc_lock);
 
         for ( i = 0; i < (1 << order); i++ )
@@ -555,7 +555,7 @@ void free_domheap_pages(struct pfn_info *pg, unsigned int order)
     }
     else if ( likely(d != NULL) )
     {
-        /* NB. May recursively lock from domain_relinquish_memory(). */
+        /* NB. May recursively lock from relinquish_memory(). */
         spin_lock_recursive(&d->page_alloc_lock);
 
         for ( i = 0; i < (1 << order); i++ )
index fd825d2cfe8004a1b36411fee1ec626e9aa3e7a0..ee87faaf931193e3289b52add6516a836a06bf60 100644 (file)
@@ -406,13 +406,6 @@ static void __enter_scheduler(void)
     
     perfc_incrc(sched_ctx);
 
-    if ( !is_idle_task(prev->domain) )
-    {
-        LOCK_BIGLOCK(prev->domain);
-        cleanup_writable_pagetable(prev->domain);
-        UNLOCK_BIGLOCK(prev->domain);
-    }
-
 #if defined(WAKE_HISTO)
     if ( !is_idle_task(next) && next->wokenup ) {
         ulong diff = (ulong)(now - next->wokenup);
index e9ad74ceeb18699470df4639afd19060529f3ca6..9d81680d2034f25782e958fad598c79bf18b8e9f 100644 (file)
@@ -8,7 +8,7 @@ extern void arch_do_createdomain(struct exec_domain *);
 extern int arch_final_setup_guestos(
     struct exec_domain *, full_execution_context_t *);
 
-extern void domain_relinquish_memory(struct domain *);
+extern void domain_relinquish_resources(struct domain *);
 
 struct arch_domain {
     struct mm_struct *active_mm;
index 9150033be865a9f19c767993ea8cc0eae920a2f4..1f842825737dfdc0b28f85bf402bee075b1efa6d 100644 (file)
@@ -2,6 +2,8 @@
 #ifndef __ASM_DOMAIN_H__
 #define __ASM_DOMAIN_H__
 
+#include <xen/mm.h>
+
 struct trap_bounce {
     unsigned long  error_code;
     unsigned long  cr2;
@@ -18,6 +20,9 @@ struct arch_domain
     l3_pgentry_t *mm_perdomain_l3;
 #endif
 
+    /* Writable pagetables. */
+    struct ptwr_info ptwr[2];
+
     /* I/O-port access bitmap mask. */
     u8 *iobmp_mask;       /* Address of IO bitmap mask, or NULL.      */
 
index 2831138fb0ccbb7ea1a6f90e59f2fd6772c57e5d..4a273526d31c4b62765903b886b3e19b8c3af295 100644 (file)
@@ -247,7 +247,7 @@ void memguard_unguard_range(void *p, unsigned long l);
 #endif
 
 /* Writable Pagetables */
-typedef struct {
+struct ptwr_info {
     /* Linear address where the guest is updating the p.t. page. */
     unsigned long l1va;
     /* Copy of the p.t. page, taken before guest is given write access. */
@@ -257,15 +257,8 @@ typedef struct {
     /* Index in L2 page table where this L1 p.t. is always hooked. */
     unsigned int l2_idx; /* NB. Only used for PTWR_PT_ACTIVE. */
     /* Info about last ptwr update batch. */
-    struct exec_domain *prev_exec_domain; /* domain making the update */
-    unsigned int        prev_nr_updates;  /* size of update batch */
-} ptwr_ptinfo_t;
-
-typedef struct {
-    ptwr_ptinfo_t ptinfo[2];
-} __cacheline_aligned ptwr_info_t;
-
-extern ptwr_info_t ptwr_info[];
+    unsigned int prev_nr_updates;
+};
 
 #define PTWR_PT_ACTIVE 0
 #define PTWR_PT_INACTIVE 1
@@ -273,27 +266,19 @@ extern ptwr_info_t ptwr_info[];
 #define PTWR_CLEANUP_ACTIVE 1
 #define PTWR_CLEANUP_INACTIVE 2
 
-void ptwr_flush(const int);
-int ptwr_do_page_fault(unsigned long);
-
-int new_guest_cr3(unsigned long pfn);
+int  ptwr_init(struct domain *);
+void ptwr_destroy(struct domain *);
+void ptwr_flush(struct domain *, const int);
+int  ptwr_do_page_fault(struct domain *, unsigned long);
 
-#define __cleanup_writable_pagetable(_what)                                 \
-do {                                                                        \
-    int cpu = smp_processor_id();                                           \
-    if ((_what) & PTWR_CLEANUP_ACTIVE)                                      \
-        if (ptwr_info[cpu].ptinfo[PTWR_PT_ACTIVE].l1va)                     \
-            ptwr_flush(PTWR_PT_ACTIVE);                                     \
-    if ((_what) & PTWR_CLEANUP_INACTIVE)                                    \
-        if (ptwr_info[cpu].ptinfo[PTWR_PT_INACTIVE].l1va)                   \
-            ptwr_flush(PTWR_PT_INACTIVE);                                   \
-} while ( 0 )
-
-#define cleanup_writable_pagetable(_d)                                    \
-    do {                                                                  \
-        if ( unlikely(VM_ASSIST((_d), VMASST_TYPE_writable_pagetables)) ) \
-        __cleanup_writable_pagetable(PTWR_CLEANUP_ACTIVE |                \
-                                     PTWR_CLEANUP_INACTIVE);              \
+#define cleanup_writable_pagetable(_d)                                      \
+    do {                                                                    \
+        if ( unlikely(VM_ASSIST((_d), VMASST_TYPE_writable_pagetables)) ) { \
+            if ( (_d)->arch.ptwr[PTWR_PT_ACTIVE].l1va )                     \
+                ptwr_flush((_d), PTWR_PT_ACTIVE);                           \
+            if ( (_d)->arch.ptwr[PTWR_PT_INACTIVE].l1va )                   \
+                ptwr_flush((_d), PTWR_PT_INACTIVE);                         \
+        }                                                                   \
     } while ( 0 )
 
 #ifndef NDEBUG
@@ -304,6 +289,8 @@ void audit_domains(void);
 #define audit_domains()  ((void)0)
 #endif
 
+int new_guest_cr3(unsigned long pfn);
+
 void propagate_page_fault(unsigned long addr, u16 error_code);
 
 /*
index 0115f7d0e52be4860a2d05b0a0ba8a70a76bdca3..a16820bc355750211c532ace38b427d0220a58ab 100644 (file)
@@ -23,7 +23,7 @@ extern int  arch_set_info_guest(
 
 extern void free_perdomain_pt(struct domain *d);
 
-extern void domain_relinquish_memory(struct domain *d);
+extern void domain_relinquish_resources(struct domain *d);
 
 extern void dump_pageframe_info(struct domain *d);